package com.fengwan.wastesort.net

import com.fengwan.wastesort.model.BaiduImageClassifyResult
import com.fengwan.wastesort.model.BaiduTokenModel
import io.reactivex.Flowable
import retrofit2.http.*

/**
 * @author : Silence丶J
 * @time : 2019/7/19
 * @description :
 */
interface BaiduAiApi {

    @POST("https://aip.baidubce.com/oauth/2.0/token")
    fun getAccessToken(
        @Query("client_id") client_id: String,
        @Query("client_secret") client_secret: String,
        @Query("grant_type") grant_type: String = "client_credentials")
    : Flowable<BaiduTokenModel>


    @Headers("Content-Type:application/x-www-form-urlencoded")
    @FormUrlEncoded
    @POST("https://aip.baidubce.com/rest/2.0/image-classify/v2/advanced_general")
    fun imageClassify(
        @Query("access_token") access_token: String,
        @Field("baike_num") baike_num: Int,
        @Field("image") image: String)
            : Flowable<BaiduImageClassifyResult>


}